import { useState } from 'react';

export default () => {
  const [loginModalVisible, setLoginModalVisible] = useState(false);
  const [loginCallback, setLoginCallback] = useState<(() => void) | null>(null);

  const showLoginModal = (callback?: () => void) => {
    setLoginModalVisible(true);
    if (callback) {
      setLoginCallback(() => callback);
    }
  };

  const hideLoginModal = () => {
    setLoginModalVisible(false);
    setLoginCallback(null);
  };

  const handleLoginSuccess = () => {
    hideLoginModal();
    if (loginCallback) {
      loginCallback();
    }
  };

  return {
    loginModalVisible,
    showLoginModal,
    hideLoginModal,
    handleLoginSuccess,
  };
}; 